/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.neu.nutrons.lib;

/**
 *
 * @author NUTRONS_PROGRAMMING
 */
public class AutoModeController {
    // Variables
    NutronsQueue cmdList = new NutronsQueue();
    AutoModeCommand curCmd = null;

    // Add commands
    public void addCommand(AutoModeCommand cmd) {
        cmdList.push(cmd);
    }

    // Execute commands
    public void handle() {
        if(curCmd == null) {
            curCmd = (AutoModeCommand) cmdList.pop();
        }

        if(curCmd != null) {
            if(curCmd.doWork()) {
                // Will grab next command on next call of handle()
                curCmd = null;
                System.out.println("work done");
            }
        }
        else {
            ;
            // Maybe add something for do Nothing?
        }
    }
}
